import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

// 第二步声明路由规则
const routes = [
  {
    path: '/',
    redirect: '/results'
  },
  {
    path: '/results/:keyword',
    name: 'results',
    component: () => import(/* webpackChunkName: "results" */ '../views/Results.vue')
  },
  {
    // 歌曲播放
    path: '/player/:id',
    name: 'player',
    component: () => import(/* webpackChunkName: "player" */ '../views/Player.vue')
  },
  {
    // 评论
    path: '/comment/:id?',
    name: 'comment',
    component: () => import(/* webpackChunkName: "comment" */ '../views/comment.vue')
  },
  {
    // MV
    path: '/video/:id',
    name: 'video',
    component: () => import(/* webpackChunkName: "video" */ '../views/video.vue')
  }
  // 剩下的业务页面逻辑请大家自行完成
]

// 第三步，实例化路由
const router = new VueRouter({
  routes
})

export default router
